// import com.alibaba.druid.sql.ast.SQLExpr;
// import com.alibaba.druid.util.FnvHash;

// import java.util.List;
// import java.util.concurrent.ConcurrentHashMap;
// import java.util.concurrent.ConcurrentMap;
#pragma once
#include "../../utils/common_ptr.h"
#include <unordered_map> 

class InsertColumnsCache_Entry
{
public:
  long hashCode64;
  string_ptr columnsString;
  string_ptr columnsFormattedString;
  long columnsFormattedStringHash;
  SQLExpr_list_ptr columns;
  InsertColumnsCache_Entry_ptr next;

  InsertColumnsCache_Entry(
      long hashCode64,
      string_ptr columnsString,
      string_ptr columnsFormattedString,
      SQLExpr_list_ptr columns,
      InsertColumnsCache_Entry_ptr next);
};

class InsertColumnsCache
{
public:
  static InsertColumnsCache_ptr global;

  std::unordered_map<long, InsertColumnsCache_Entry_ptr> cache;

  InsertColumnsCache_Entry_list_ptr buckets;
  int indexMask;

  InsertColumnsCache(int tableSize);

  InsertColumnsCache_Entry_ptr get(long hashCode64);

  BOOL_ptr put(long hashCode64, string_ptr columnsString, string_ptr columnsFormattedString, SQLExpr_list_ptr columns);
};
